package Atop100.huisu;

import java.util.ArrayList;
import java.util.List;

public class Class17 {

    List<String> ans;
    StringBuffer sb;
    public List<String> letterCombinations(String digits) {
        String[] numString = {"", "", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};
        sb=new StringBuffer();
        ans=new ArrayList<>();
        if (digits==null){
            return  ans;
        }
        char[] chars = digits.toCharArray();
        backtracking(0,chars,numString);
        return  ans;
    }

    public  void  backtracking(int startIndex,char[] digits,String[]  numString){
        if (sb.length()== digits.length){
            ans.add(new String(sb));
            return;
        }
        for (int i = startIndex; i<digits.length; i++) {
            for (int j = 0; j < numString[digits[i]-'0'].length(); j++) {
                sb.append(numString[digits[i]-'0'].toCharArray()[j]);
                backtracking(i+1,digits,numString);
                sb.deleteCharAt(sb.length()-1);
            }
        }
    }

    public static void main(String[] args) {
//        Class17 class17 = new Class17();
//        List<String> strings = class17.letterCombinations("23");
//        String s="";
        String s=null;
        System.out.println(s==null);

    }


}
